summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKelebek1 <eeeedddccc@hotmail.co.uk>2022-08-02 06:28:31 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2022-08-02 07:01:54 +0200
commit658e1ee4267f0475445c7152560783444fcda7d2 (patch)
tree658e53e95e9df0bd5654dea6b42fcba3d52ea83a
parentMake coretiming waiting more accurate (diff)
downloadyuzu-658e1ee4267f0475445c7152560783444fcda7d2.tar
yuzu-658e1ee4267f0475445c7152560783444fcda7d2.tar.gz
yuzu-658e1ee4267f0475445c7152560783444fcda7d2.tar.bz2
yuzu-658e1ee4267f0475445c7152560783444fcda7d2.tar.lz
yuzu-658e1ee4267f0475445c7152560783444fcda7d2.tar.xz
yuzu-658e1ee4267f0475445c7152560783444fcda7d2.tar.zst
yuzu-658e1ee4267f0475445c7152560783444fcda7d2.zip
-rw-r--r--src/core/core_timing.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index b45c1b918..a75bfea60 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -143,13 +143,17 @@ void CoreTiming::ScheduleLoopingEvent(std::chrono::nanoseconds start_time,
std::chrono::nanoseconds resched_time,
const std::shared_ptr<EventType>& event_type,
std::uintptr_t user_data, bool absolute_time) {
- std::scoped_lock scope{basic_lock};
- const auto next_time{absolute_time ? start_time : GetGlobalTimeNs() + start_time};
+ {
+ std::scoped_lock scope{basic_lock};
+ const auto next_time{absolute_time ? start_time : GetGlobalTimeNs() + start_time};
+
+ event_queue.emplace_back(
+ Event{next_time.count(), event_fifo_id++, user_data, event_type, resched_time.count()});
- event_queue.emplace_back(
- Event{next_time.count(), event_fifo_id++, user_data, event_type, resched_time.count()});
+ std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>());
+ }
- std::push_heap(event_queue.begin(), event_queue.end(), std::greater<>());
+ event.Set();
}
void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type,